<div class="dux-box am-padding am-text-center">
    <h1 class="am-text-danger">微信支付</h1>
    <p>请继续完成微信支付</p>
    <p style="display: none" id="open"><a class="am-btn am-btn-danger am-btn-sm am-btn-block" href='javascript:window.location.href = "weixin://" + document.URL;'>微信中打开链接</a></p>
</div>

<script type="text/javascript" charset="utf-8">

    function isWeiXin(){
        var ua = window.navigator.userAgent.toLowerCase();
        if(ua.match(/MicroMessenger/i) == 'micromessenger'){
            return true;
        }else{
            return false;
        }
    }

    var url = '{$data.url}';

    function onBridgeReady() {
        WeixinJSBridge.invoke(
            'getBrandWCPayRequest', {
                "appId": "{$data.appId}",
                "timeStamp": "{$data.timeStamp}",
                "nonceStr": "{$data.nonceStr}",
                "package": "{$data.package}",
                "signType": "{$data.signType}",
                "paySign": "{$data.paySign}"
            },function(res) {
                if( res.err_msg == "get_brand_wcpay_request:ok"){
                    window.location.href = url;
                }else{
                    alert(res.err_msg);
                    history.go(-1);
                }
            });
    }
    if (typeof WeixinJSBridge == "undefined") {
        if (document.addEventListener) {
            document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
        } else if (document.attachEvent) {
            document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
            document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
        }
    } else {
        onBridgeReady();
    }


</script>